Component({
  properties: {
    layout: {
      type: Array,
      value: []
    },
    selectedIndex: {
      type: Number,
      value: 0
    },
  },
  data: {
    containerPaddingBottom: 0,
  },
  methods: {
    onTap(e) {
      const { id }= e.currentTarget.dataset;
      // this.triggerEvent("selected", { id })
      // this.setData({
      //   selectedIndex: id
      // });

      wx.switchTab({
        url: '../' + this.data.layout[id].url,
        fail(e) {
          console.log(e)
        }
      })
    }
  },
  lifetimes: {
    attached() {
      let info = wx.getSystemInfoSync()
      this.setData({
        containerPaddingBottom: info.windowHeight - info.safeArea.bottom
      })
    }
  }
})
